.class public final Lcom/burstly/lib/util/LoggerExt;
.super Ljava/lang/Object;
.source "LoggerExt.java"


# static fields
.field public static final DEBUG_LEVEL:I = 0x3

.field public static final ERROR_LEVEL:I = 0x6

.field public static final INFO_LEVEL:I = 0x4

.field private static final INSTANCE:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final LOG_LEVEL_NAMES:Ljava/util/Map; = null
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/Integer;",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field public static final NONE_LEVEL:I = 0x7

.field private static final SDK_VERSION:Ljava/lang/String; = null

.field private static final TAG:Ljava/lang/String; = "Logger"

.field public static final WARN_LEVEL:I = 0x5

.field private static sLogLevel:I


# direct methods
.method static constructor <clinit>()V
    .locals 4

    .prologue
    const/4 v3, 0x3

    .line 42
    new-instance v0, Lcom/burstly/lib/util/LoggerExt;

    invoke-direct {v0}, Lcom/burstly/lib/util/LoggerExt;-><init>()V

    sput-object v0, Lcom/burstly/lib/util/LoggerExt;->INSTANCE:Lcom/burstly/lib/util/LoggerExt;

    .line 72
    sput v3, Lcom/burstly/lib/util/LoggerExt;->sLogLevel:I

    .line 77
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Burstly SDK v."

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    sget-object v1, Lcom/burstly/lib/constants/Constants;->SDK_VERSION:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/util/LoggerExt;->SDK_VERSION:Ljava/lang/String;

    .line 82
    new-instance v0, Ljava/util/HashMap;

    const/16 v1, 0xa

    invoke-direct {v0, v1}, Ljava/util/HashMap;-><init>(I)V

    sput-object v0, Lcom/burstly/lib/util/LoggerExt;->LOG_LEVEL_NAMES:Ljava/util/Map;

    .line 85
    sget-object v0, Lcom/burstly/lib/util/LoggerExt;->LOG_LEVEL_NAMES:Ljava/util/Map;

    const/4 v1, 0x7

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    const-string v2, "Logger.NONE_LEVEL"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 86
    sget-object v0, Lcom/burstly/lib/util/LoggerExt;->LOG_LEVEL_NAMES:Ljava/util/Map;

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    const-string v2, "Logger.DEBUG_LEVEL"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 87
    sget-object v0, Lcom/burstly/lib/util/LoggerExt;->LOG_LEVEL_NAMES:Ljava/util/Map;

    const/4 v1, 0x4

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    const-string v2, "Logger.INFO_LEVEL"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 88
    sget-object v0, Lcom/burstly/lib/util/LoggerExt;->LOG_LEVEL_NAMES:Ljava/util/Map;

    const/4 v1, 0x5

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    const-string v2, "Logger.WARN_LEVEL"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 89
    sget-object v0, Lcom/burstly/lib/util/LoggerExt;->LOG_LEVEL_NAMES:Ljava/util/Map;

    const/4 v1, 0x6

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    const-string v2, "Logger.ERROR_LEVEL"

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 90
    return-void
.end method

.method private constructor <init>()V
    .locals 0

    .prologue
    .line 95
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 96
    return-void
.end method

.method private static checkLogLevel(I)I
    .locals 3
    .parameter "newLogLevel"

    .prologue
    .line 243
    const/4 v0, 0x7

    if-gt p0, v0, :cond_0

    const/4 v0, 0x3

    if-ge p0, v0, :cond_1

    .line 244
    :cond_0
    const-string v0, "Logger"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Provided log level "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " is not NONE_LEVEL, DEBUG_LEVEL, INFO_LEVEL, WARN_LEVEL or ERROR_LEVEL. Skipped invalid log level. Log level has been set to WARN_LEVEL."

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 249
    const/4 p0, 0x5

    .line 251
    .end local p0
    :cond_1
    return p0
.end method

.method private static fitsLogLevel(I)Z
    .locals 1
    .parameter "msgLogLevel"

    .prologue
    .line 190
    sget v0, Lcom/burstly/lib/util/LoggerExt;->sLogLevel:I

    if-lt p0, v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public static getInstance()Lcom/burstly/lib/util/LoggerExt;
    .locals 1

    .prologue
    .line 212
    sget-object v0, Lcom/burstly/lib/util/LoggerExt;->INSTANCE:Lcom/burstly/lib/util/LoggerExt;

    return-object v0
.end method

.method public static getLogLevel()I
    .locals 1

    .prologue
    .line 260
    sget v0, Lcom/burstly/lib/util/LoggerExt;->sLogLevel:I

    return v0
.end method

.method private varargs log(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    .locals 6
    .parameter "level"
    .parameter "tag"
    .parameter "template"
    .parameter "params"

    .prologue
    .line 108
    const-string v1, ""

    .line 109
    .local v1, toReturn:Ljava/lang/String;
    if-eqz p3, :cond_1

    invoke-static {p1}, Lcom/burstly/lib/util/LoggerExt;->fitsLogLevel(I)Z

    move-result v3

    if-eqz v3, :cond_1

    .line 110
    move-object v0, p3

    .line 111
    .local v0, message:Ljava/lang/String;
    array-length v3, p4

    if-eqz v3, :cond_0

    .line 112
    invoke-static {p3, p4}, Ljava/text/MessageFormat;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    .line 113
    move-object v1, v0

    .line 115
    :cond_0
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    new-instance v4, Ljava/text/SimpleDateFormat;

    const-string v5, "dd-MM-yy HH:mm:ss:SSS"

    invoke-direct {v4, v5}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V

    new-instance v5, Ljava/util/Date;

    invoke-direct {v5}, Ljava/util/Date;-><init>()V

    invoke-virtual {v4, v5}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 116
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    sget-object v4, Lcom/burstly/lib/util/LoggerExt;->SDK_VERSION:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, " "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 117
    .local v2, versionedTag:Ljava/lang/String;
    packed-switch p1, :pswitch_data_0

    .line 129
    invoke-static {v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 132
    .end local v0           #message:Ljava/lang/String;
    .end local v2           #versionedTag:Ljava/lang/String;
    :cond_1
    :goto_0
    return-object v1

    .line 119
    .restart local v0       #message:Ljava/lang/String;
    .restart local v2       #versionedTag:Ljava/lang/String;
    :pswitch_0
    invoke-static {v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 122
    :pswitch_1
    invoke-static {v2, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 125
    :pswitch_2
    invoke-static {v2, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 117
    :pswitch_data_0
    .packed-switch 0x3
        :pswitch_0
        :pswitch_1
        :pswitch_2
    .end packed-switch
.end method

.method public static setLogLevel(I)V
    .locals 5
    .parameter "logLevel"

    .prologue
    .line 231
    move v0, p0

    .line 232
    .local v0, level:I
    invoke-static {v0}, Lcom/burstly/lib/util/LoggerExt;->checkLogLevel(I)I

    move-result v1

    sput v1, Lcom/burstly/lib/util/LoggerExt;->sLogLevel:I

    .line 233
    const-string v2, "Logger"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Log level has been set to "

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    sget-object v1, Lcom/burstly/lib/util/LoggerExt;->LOG_LEVEL_NAMES:Ljava/util/Map;

    sget v4, Lcom/burstly/lib/util/LoggerExt;->sLogLevel:I

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    invoke-interface {v1, v4}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v2, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 234
    return-void
.end method


# virtual methods
.method public varargs logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    .locals 1
    .parameter "tag"
    .parameter "template"
    .parameter "params"

    .prologue
    .line 168
    const/4 v0, 0x3

    invoke-direct {p0, v0, p1, p2, p3}, Lcom/burstly/lib/util/LoggerExt;->log(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public varargs logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    .locals 1
    .parameter "tag"
    .parameter "template"
    .parameter "params"

    .prologue
    .line 156
    const/4 v0, 0x6

    invoke-direct {p0, v0, p1, p2, p3}, Lcom/burstly/lib/util/LoggerExt;->log(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public varargs logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    .locals 1
    .parameter "tag"
    .parameter "template"
    .parameter "params"

    .prologue
    .line 144
    const/4 v0, 0x4

    invoke-direct {p0, v0, p1, p2, p3}, Lcom/burstly/lib/util/LoggerExt;->log(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V
    .locals 3
    .parameter "tag"
    .parameter "exception"

    .prologue
    .line 201
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "BurstlySDK="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-static {}, Lcom/burstly/lib/BurstlySdk;->getSdkVersion()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "-"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    sget-object v2, Lcom/burstly/lib/constants/Constants;->BUILD_ID:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {p2, v1}, Lcom/burstly/lib/util/Utils;->addInStackTrace(Ljava/lang/Throwable;Ljava/lang/String;)V

    .line 202
    invoke-static {p2}, Landroid/util/Log;->getStackTraceString(Ljava/lang/Throwable;)Ljava/lang/String;

    move-result-object v0

    .line 203
    .local v0, stringStackTrace:Ljava/lang/String;
    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-virtual {p0, p1, v0, v1}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 204
    return-void
.end method

.method public varargs logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    .locals 1
    .parameter "tag"
    .parameter "template"
    .parameter "params"

    .prologue
    .line 180
    const/4 v0, 0x5

    invoke-direct {p0, v0, p1, p2, p3}, Lcom/burstly/lib/util/LoggerExt;->log(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method
